package io.renren.modules.communityService.controller;

import java.util.Arrays;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.communityService.dto.DbSuggestionsDTO;
import io.renren.modules.communityService.vo.DbSuggestionsVO;
import io.renren.modules.communityService.service.DbSuggestionsService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 投诉建议
 *
 * @author chenweilong
 * @email 1433471850@qq.com
 * @date 2021-03-21 14:40:08
 */
@RestController
@RequestMapping("communityService/dbsuggestions")
@Api(value = "pc投诉建议",tags = "pc投诉建议")
public class DbSuggestionsController {
    @Autowired
    private DbSuggestionsService dbSuggestionsService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @ApiOperation(value = "list",notes = "list")
    public R list(DbSuggestionsDTO dbSuggestions){
        PageUtils page = dbSuggestionsService.queryPage(dbSuggestions);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @ApiOperation(value = "info",notes = "info")
    public R info(@PathVariable("id") Integer id){
		DbSuggestionsVO dbSuggestions = dbSuggestionsService.getById(id);

        return R.ok().put("dbSuggestions", dbSuggestions);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @ApiOperation(value = "save",notes = "save")
    public R save(@RequestBody DbSuggestionsDTO dbSuggestions){
		dbSuggestionsService.save(dbSuggestions);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @ApiOperation(value = "update",notes = "update")
    public R update(@RequestBody DbSuggestionsDTO dbSuggestions){
		dbSuggestionsService.updateById(dbSuggestions);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @ApiOperation(value = "delete",notes = "delete")
    public R delete(@RequestBody Integer[] ids){
		dbSuggestionsService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
